//
//  AddressTwoCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/27.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "AddressTwoCell.h"
@interface AddressTwoCell ()
@property (weak, nonatomic) IBOutlet UIButton *leftBtn;
@property (weak, nonatomic) IBOutlet UILabel *leftLabel;
@property (weak, nonatomic) IBOutlet UIButton *deleBtn;
@property (weak, nonatomic) IBOutlet UIButton *editBtn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomMargin;

@end


@implementation AddressTwoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundColor = [UIColor whiteColor];
    self.leftBtn.imageEdgeInsets = UIEdgeInsetsMake(12, 12, 12, 12);
    
    self.bottomMargin.constant = 0;
    
    self.leftLabel.font = MYFONT(14);
    
    self.leftLabel.textColor = darkGray;
    
    self.deleBtn.titleLabel.font = MYFONT(14);
    
    [self.deleBtn setTitleColor:darkGray forState:UIControlStateNormal];
    [self.deleBtn setTitleColor:darkGray forState:UIControlStateHighlighted];
    [self.editBtn setTitleColor:darkGray forState:UIControlStateNormal];
    [self.editBtn setTitleColor:darkGray forState:UIControlStateHighlighted];

    self.editBtn.titleLabel.font = MYFONT(14);

}

- (void)setModel:(AddressInfoModel *)model{
    _model = model;
    
    if ([_model.is_default isEqualToString:@"1"]) {
        
        self.leftBtn.selected = YES;
        
    } else {
        
        self.leftBtn.selected = NO;

    }
    
    
    
    
}



- (IBAction)deleBtnDidTap:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(deleBtnDidClickWith:)]) {
        [self.delegate deleBtnDidClickWith:self.index];
    }
    
}

- (IBAction)leftBtnDidTap:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(leftBtnDidTap:)]) {
        [self.delegate leftBtnDidTap:self.index];
    }
    
}

- (IBAction)editBtnDidTap:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(editBtnDidClickWith:)]) {
        [self.delegate editBtnDidClickWith:self.index];
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
